<?php
#=================================================================================================================
#=================================================================================================================
#	Define all possible options in drop-down menu
#=================================================================================================================
#=================================================================================================================


 if( isset($_GET['edit_sesiune']) or isset($_POST['edit_sesiune']) or isset($_GET['view_sesiune']) or  isset($_POST['view_sesiune']) )
 {
	$query_sesiuni = mysqli_query($dbc, "SELECT `id_furnizori_programe`,`data_sesiunii`,`desfasurat_in_alt_judet`,`nr_persoane_inscrise`,`nr_persoane_finalizat`,`nr_participanti_absolvire`,`nr_absolventi_barbati_sub_25`,`nr_absolventi_barbati_peste_25`,`nr_asolventi_femei_sub_25`,`nr_absolventi_femei_peste_25`,`nr_absolventi_alte_sesiuni`,`observatii` FROM anc.sesiuni WHERE `id_furnizori_programe`='$var_id_program' AND `id_sesiune`='$var_id_sesiune'");	 
	
	if( $query_sesiuni)
	{
		if($results_sesiuni = mysqli_fetch_assoc($query_sesiuni))
		{
			
			$form_for_table = array(
			#----------------------------------------------------------------------
			#						Tabel										  |
			#----------------------------------------------------------------------
				
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Data sesiunii',
					  'post_name' 			 => 'session_date',
					  'placeholder'          => 'AAAA-LL-ZZ',
					  'title'				=> 'An-Luna-Zi',
					  'validation_function'   => 'dateLTEToday',
					  'regex'				=> '/^[1-2][0-9]{3}-(0[1-9]|10|11|12)-(0[1-9]|[1-2][0-9]|3[0-1])$/',
					  'errors' 				=> array(
													'empty_field_or_no_selection_error' => 'Introduceti o data a sesiunii<br />',
													'no_regex_pattern_found_error' => 'Introduceti o data valida a sesiunii<br />' ),
					  'field_size' 			=> 40,
					  'current_value'		 => $results_sesiuni['data_sesiunii'],
					  'max_length' 			=> 100),
					  
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr persoane inscrise la sesiune',
					  'post_name' 			 => 'session_subscriber_nr',
					  'field_size' 			=> 40,	
					  'max_length' 			=> 10,
					  'regex'				 => '/^[0-9]+$/',
					  'current_value'		 => $results_sesiuni['nr_persoane_inscrise'],
					  'errors' 				=> array(
													'empty_field_or_no_selection_error' => 'Introduceti nr persoane inscrise la sesiune<br />',
													'no_regex_pattern_found_error' => 'Nr persoane inscrise la sesiune invalid<br />' )),
								
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr persoane ce au finalizat sesiunea',
					  'post_name' 			 => 'session_finalists',
					  'field_size' 			=> 40,
					  'regex'				 => '/^[0-9]+$/',
					  'current_value'		 => $results_sesiuni['nr_persoane_finalizat'],
					  'max_length' 			=> 100),
					  
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr persoane ce au participat la examenul de absolvire',
					  'post_name' 			 => 'exam_participants',
					  'field_size' 			=> 40,
					  'regex'				 => '/^[0-9]+$/',
					  'current_value'		 => $results_sesiuni['nr_participanti_absolvire'],
					  'max_length' 			=> 100),
				
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr de femei absolvente sub 25 de ani',
					  'post_name' 			 => 'women_graduates_less_25',
					  'field_size' 			=> 40,
					  'regex'				 => '/^[0-9]+$/',
					  'current_value'		 => $results_sesiuni['nr_participanti_absolvire'],
					  'max_length' 			=> 100),
					 
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr de barbati absolventi sub 25 ani',
					  'post_name' 			 => 'men_graduates_less_25',
					  'field_size' 			=> 40,
					  'current_value'		 => $results_sesiuni['nr_absolventi_barbati_sub_25'],
					  'regex'				 => '/^[0-9]+$/',
					  'max_length' 			=> 100),
					  
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr de femei absolvente peste 25 ani',
					  'post_name' 			 => 'women_graduates_more_25',
					  'field_size' 			=> 40,
					  'current_value'		 => $results_sesiuni['nr_asolventi_femei_sub_25'],
					  'regex'				 => '/^[0-9]+$/',
					  'max_length' 			=> 100),
					  
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr barbati absolventi peste 25 ani',
					  'post_name' 			 => 'men_graduates_more_25',
					  'field_size' 			=> 40,
					  'current_value'		 => $results_sesiuni['nr_absolventi_femei_peste_25'],
					  'regex'				 => '/^[0-9]+$/',
					  'max_length' 			=> 100),
					  
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Nr absolventi din alte sesiuni',
					  'post_name' 			 => 'other_sessions_graduates',
					  'field_size' 			=> 40,
					  'current_value'		 => $results_sesiuni['nr_absolventi_alte_sesiuni'],
					  'regex'				 => '/^[0-9]+$/',
					  'max_length' 			=> 100),
					  
				array('field_type' 			=> 'drop_down_list',
					  'field_display_name' 	=> 'Desfasurat in alt judet',
					  'post_name' 			 => 'other_county',
					  'field_size' 			=> 40,
					  'max_length' 			=> 100,
					  'current_value'		 => $results_sesiuni['desfasurat_in_alt_judet'],
					  'initial_values'  		=> array('opt1' => 'Da',
													   'opt2' => 'Nu')
						),
					  
				array('field_type' 			=> 'text',
					  'field_display_name' 	=> 'Observatii',
					  'post_name' 			 => 'observations',
					  'field_size' 			=> 40,
					  'current_value'		 => $results_sesiuni['observatii'],
					  'max_length' 			=> 100)
		 
);	
			
		}
		
	}
 }
else
{

	
	$form_for_table = array(
	#----------------------------------------------------------------------
	#						Tabel										  |
	#----------------------------------------------------------------------
		
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Data sesiunii',
			  'placeholder'          => 'AAAA-LL-ZZ',
			  'title'				=> 'An-Luna-Zi',
			  'validation_function'   => 'dateLTEToday',
			  'regex'				=> '/^[1-2][0-9]{3}-(0[1-9]|10|11|12)-(0[1-9]|[1-2][0-9]|3[0-1])$/',
			  'errors' 				=> array(
													'empty_field_or_no_selection_error' => 'Introduceti o data a sesiunii<br />',
													'no_regex_pattern_found_error' => 'Introduceti o data valida a sesiunii<br />' ),
			  'post_name' 			 => 'session_date',
			  'field_size' 			=> 40,
			  'max_length' 			=> 100),
			  
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr persoane inscrise la sesiune',
			  'post_name' 			 => 'session_subscriber_nr',
			  'field_size' 			=> 40,	
			  'max_length' 			=> 10,
			  'regex'				 => '/^[0-9]+$/',
			  'errors' 				=> array(
											'empty_field_or_no_selection_error' => 'Introduceti nr persoane inscrise la sesiune<br />',
											'no_regex_pattern_found_error' => 'Nr persoane inscrise la sesiune invalid<br />' )),
						
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr persoane ce au finalizat sesiunea',
			  'post_name' 			 => 'session_finalists',
			  'field_size' 			=> 40,
			  'regex'				 => '/^[0-9]+$/',
			  'max_length' 			=> 100),
			  
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr persoane ce au participat la examenul de absolvire',
			  'post_name' 			 => 'exam_participants',
			  'field_size' 			=> 40,
			  'regex'				 => '/^[0-9]+$/',
			  'max_length' 			=> 100),
		
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr de femei absolvente sub 25 de ani',
			  'post_name' 			 => 'women_graduates_less_25',
			  'field_size' 			=> 40,
			  'regex'				 => '/^[0-9]+$/',
			  'max_length' 			=> 100),
			 
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr de barbati absolventi sub 25 ani',
			  'post_name' 			 => 'men_graduates_less_25',
			  'field_size' 			=> 40,
			  'regex'				 => '/^[0-9]+$/',
			  'max_length' 			=> 100),
			  
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr de femei absolvente peste 25 ani',
			  'post_name' 			 => 'women_graduates_more_25',
			  'field_size' 			=> 40,
			  'regex'				 => '/^[0-9]+$/',
			  'max_length' 			=> 100),
			  
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr barbati absolventi peste 25 ani',
			  'post_name' 			 => 'men_graduates_more_25',
			  'field_size' 			=> 40,
			  'regex'				 => '/^[0-9]+$/',
			  'max_length' 			=> 100),
			  
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Nr absolventi din alte sesiuni',
			  'post_name' 			 => 'other_sessions_graduates',
			  'field_size' 			=> 40,
			  'regex'				 => '/^[0-9]+$/',
			  'max_length' 			=> 100),
			  
		array('field_type' 			=> 'drop_down_list',
			  'field_display_name' 	=> 'Desfasurat in alt judet',
			  'post_name' 			 => 'other_county',
			  'field_size' 			=> 40,
			  'max_length' 			=> 100,
			  'current_value'		 => 'lala',
			  'initial_values'  		=> array('opt1' => 'Da',
											   'opt2' => 'Nu')
				),
			  
		array('field_type' 			=> 'text',
			  'field_display_name' 	=> 'Observatii',
			  'post_name' 			 => 'observations',
			  'field_size' 			=> 40,
			  'max_length' 			=> 100)
			 
	);	
}
#=================================================================================================================
#	End of drop-down elemnts
#=================================================================================================================

?>